package com.atguigu.lease.test;

import io.minio.MinioClient;
import io.minio.ObjectWriteResponse;
import io.minio.PutObjectArgs;
import io.minio.UploadObjectArgs;
import io.minio.errors.*;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class test2 {
    public static void main(String[] args) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
        MinioClient minioClient = MinioClient.builder()
                .endpoint("http://192.168.100.100:9000")
                .credentials("minioadmin", "minioadmin")
                .build();
//        PutObjectArgs build = PutObjectArgs.builder()
//                .bucket("a001")
//                .stream(null,0,1)
//                .build();

        //ObjectWriteResponse objectWriteResponse = minioClient.putObject(build);

        UploadObjectArgs build1 = UploadObjectArgs.builder()
                .bucket("a001")
                .filename("hello-mp/src/main/java/com/atguigu/lease/picture/鬼刀.jpg")
                .object("2025/06/18/gd.jpg")
                .build();

        ObjectWriteResponse objectWriteResponse = minioClient.uploadObject(build1);
        System.out.println(objectWriteResponse);
        System.out.println("http://192.168.100.100:9000/2025/06/18/gd.jpg");
    }



}
